#4 new
Philipp Pirozhkov

Extending filters with native code docs

Reported by Philipp Pirozhkov | November 30th, 2008 @ 12:17 AM

The goal is to provide such a functionality:

src/behave/child_filter.re:


module ChildFilter
  def filter(string)
     if string == 'damn'
       '****'

renderer = Retem.new()
renderer.add_filter(ChildFilter)
template = renderer.parse('{a|child_filter}')
template.render({~a: 'god damn}) # god ****

This should be described in README, and behavior should be derscribed.

No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Templating engine for Ryan/Reia
Retem provides a convenient syntax and a lot of features available out of the box:

* variables
* flow control
* filters
* i18n
* template nesting

== Usage
renderer = Retem.new()
template = renderer.parse("""Total {apples|count:~apples}
{for apple in apples} {apple.color apple.weight|kg} {end}""")
apples = [{~color: 'red', ~weight: 0.2}, {~color: 'yellow', ~weight: 0.15}]
renderer.render({~apples: apples})
=> Total 2 apples
.. red 0.2kg
.. yellow 0.15kg

There are a lot of templating examples in README on http://github.com/pirj/ryan/tree/master/src/retem

People watching this ticket

Pages